package com.stxx.assistant.framwork.init;

import cn.hutool.core.util.URLUtil;
import com.stxx.assistant.framwork.utils.HostUtils;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Inject;
import org.noear.solon.core.event.AppLoadEndEvent;
import org.noear.solon.core.event.EventListener;

import java.nio.charset.Charset;

/**
 * @author Fuzhenlei
 * @date 2025/02/20 17:32
 */
@Component
public class AppLoadEndListener implements EventListener<AppLoadEndEvent> {
    @Inject("${zlmediakit.url:http://locahost:1201}")
    private String zlmUrl;
    @Inject("${zlmediakit.secret}")
    private String secret;
    @Override
    public void onEvent(AppLoadEndEvent event) throws Throwable {
//        StringBuilder sb = new StringBuilder();
//        sb.append(zlmUrl+"/index/api/setServerConfig?");
//        sb.append("secret=").append(secret);
//        sb.append("&hook.on_stream_none_reader=");
//        String hostUrl = "http://"+HostUtils.getHost().getHostAddress()+":"+HostUtils.getPort()+"/zlm/hook/on_stream_none_reader";
//        sb.append(URLUtil.encode(hostUrl, Charset.defaultCharset()));
//        System.out.println(sb.toString());
    }
}
